package com.rem.chat.controller;

import com.rem.chat.pojo.response.CommonResult;
import com.rem.chat.service.dto.MessageSendDTO;
import com.rem.chat.websocket.MessageHandler;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

/**
 * @author: Themberfue
 * @date: 2025/6/17 15:38
 * @description:
 */
@RestController
public class TestController {
    @Resource
    MessageHandler messageHandler;

    @RequestMapping("/test")
    public CommonResult<MessageSendDTO<Object>> test() {
        MessageSendDTO<Object> messageSendDTO = MessageSendDTO.builder()
                    .messageContent("测试广播消息:" + new Date())
                    .build();
        messageHandler.sendMessage(messageSendDTO);
        return CommonResult.success(messageSendDTO);
    }
}
